<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>地震局培训平台</title>
		<link rel="stylesheet" href="style/login.css" />
	</head>

	<body>
		<div id="show">
			<div class="loginbox">
				<div class="head"></div>
				<div class="main login">
					<div class="title"></div>
					<div class="registerbox box">
						
						<div class="text">没有账号？<span class="registerbtn">立即注册</span></div>
					</div>
					<div class="inputbox">
						<input type="text" id="number" class="input" placeholder="手机号"/>
						<input type="password" id="password" class="input" placeholder="密码"/>
					</div>
					<div class="forgetbtn">忘记密码</div>
					<div class="loginbtn btn"></div>
					<div class="other">
						<div class="text">其他方式登录</div>
						<div class="xinlang"></div>
						<div class="weixin"></div>
						<div class="qq"></div>
					</div>
				</div>
			</div>
		</div>

		<script type="text/javascript" src="script/jquery.min.js"></script>
		<script type="text/javascript" src="script/ishoock.tools.js"></script>
		<script type="text/javascript" src="script/common.js"></script>
		<script>
			//点击登录按钮
			$(".btn").on("click",function(){
				var reg = /0?(13|14|15|17|18)[0-9]{9}/;
				var username = $("#number").val();
				var pwd = $("#password").val();
				if (pwd == '' || username  == '') {
					alert("用户名或密码不能为空")
					return false;
				}else if(reg.test(username)){
					
					$.get(host+"user/login",{"userId":$("#number").val(),"password":$("#password").val()},function(data){
						if(data&&data.code=='fail'){
							alert("用户名或密码不正确");
						}else{
							window.location.href="index.html";
						}
					})
					
				}else{
					alert("请输入正确的手机号")
					
				}
			});
			//点击立即注册
			$(".registerbtn").on("click",function(){
				window.location.href="register.html";
			});
		</script>
	</body>

</html>